<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('修改项目信息')" />
	<th:block th:include="include :: ztree-css" />
</head>
<body class="white-bg">
	<div class="wrapper wrapper-content animated fadeInRight ibox-content">
		<form class="form-horizontal m" id="form-role-edit" th:object="${project}">
			<input id="id" name="id" type="hidden" th:field="*{id}"/>
			<input id="code" name="code" type="hidden" th:field="*{code}"/>
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">项目名称：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="name" id="name" th:field="*{name}" required>
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-3 control-label is-required">起始年龄：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="startAge" id="startAge" th:field="*{startAge}" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">截止年龄：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="endAge" id="endAge" th:field="*{endAge}" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">起始年级：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="startGrade" id="startGrade" th:field="*{startGrade}" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">截止年级：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="endGrade" id="endGrade" th:field="*{endGrade}" required>
				</div>
			</div>



		</form>
	</div>
	<th:block th:include="include :: footer" />
	<th:block th:include="include :: ztree-js" />
	<script type="text/javascript">
	     $(function() {

		});


		function edit() {
			var id = $("input[name='id']").val();
			var code = $("input[name='code']").val();
			var name = $("input[name='name']").val();
			var startAge = $("input[name='startAge']").val();
			var endAge = $("input[name='endAge']").val();
			var startGrade = $("input[name='startGrade']").val();
			var endGrade = $("input[name='endGrade']").val();
			$.ajax({
				cache : true,
				type : "POST",
				url : ctx + "business/integration/edit",
				data : {
					"id": id,
					"code": code,
					"name": name,
					"startAge": startAge,
					"endAge": endAge,
					"startGrade": startGrade,
					"endGrade": endGrade
				},
				async : false,
				error : function(request) {
					$.modal.alertError("系统错误");
				},
				success : function(data) {
					$.operate.successCallback(data);
				}
			});
		}
		
		function submitHandler() {
	        if ($.validate.form()) {
	        	edit();
	        }
	    }
	</script>
</body>
</html>
